package f_Polymorphism;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package f_Polymorphism
 * @date 2024/3/31 下午1:11
 */
public class Test01 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        dog.eat();
        dog.lookHome();
        Cat cat = new Cat();
        cat.eat();
        cat.catchMouse();
        System.out.println("-----------------------------------------------------------------");
        //多态new对象
        Animal animal = new Dog();
        animal.eat();//调用的是dog中重写的方法
        //多态不能调用子类特有方法
        Animal animal1 = new Cat();
        animal1.eat();
    }
    }

